<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">

<script>
'use strict';

tr.b.unittest.testSuite(function() {
  test('regulatorImport', function() {
    const lines = [
      ' kworker/0:2H-14312 [000] ...1 143713.787749: ' +
        'regulator_set_voltage: name=krait0 (810000-1100000)',
      ' kworker/0:2H-14312 [000] ...1 143713.787778: ' +
        'regulator_set_voltage_complete: name=krait0, val=810000',
      ' kworker/0:2H-14312 [000] ...1 143714.037871: ' +
        'regulator_set_voltage: name=krait0 (800000-1100000)',
      ' kworker/0:2H-14312 [000] ...1 143714.037895: ' +
        'regulator_set_voltage_complete: name=krait0, val=800000',
      'kworker/0:1-30321 [000] ...1 144568.624596: ' +
        'regulator_enable: name=8941_smbb_boost',
      'kworker/0:1-30321 [000] ...1 144568.624715: ' +
        'regulator_enable_delay: name=8941_smbb_boost',
      'kworker/0:1-30321 [000] ...1 144568.624723: ' +
        'regulator_enable_complete: name=8941_smbb_boost',
      'kworker/0:1-30321 [000] ...1 144568.653546: ' +
        'regulator_disable: name=8941_smbb_boost',
      'kworker/0:1-30321 [000] ...1 144568.654785: ' +
        'regulator_disable_complete: name=8941_smbb_boost'
    ];
    const m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
      shiftWorldToZero: false
    });
    assert.isFalse(m.hasImportWarnings);

    assert.property(m.kernel.counters, 'null.vreg krait0 voltage');
    assert.property(m.kernel.counters, 'null.vreg 8941_smbb_boost enabled');
  });
});
</script>
